﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HousingDistribution
{
    //配偶信息
    public struct MateInfo
    {
        public string name;
        public string unit;
        public string rank;
    }

    //房子信息
    public struct HousingInfo
    {
        public string addr;
        public string roomNum;
        public string area;
    }

    //房屋居住时间
    public struct HousingOccupancyInfo
    {
        public int id;
        public DateTime checkinTime;
    }

    //人员类型枚举
    public enum PersonTypeEnum
    {
        Unknown = 0,
        ArmMan = 1,
        Staff = 2,
        NCO = 3,
        Worker = 4,
        Retiree = 5,
        Others = 6
    }

    //工作状态类型枚举
    public enum WorkStatusEnum
    {
        Unknown = 0,
        Onduty = 1,
        Retiree = 2,
        Transferred = 3,
        Fired = 4,
        Martyred = 5,
        Demobilization = 6
    }

    public enum PersonMaritalEnum
    {
        Unknown = 0,
        Married = 1,
        Unmarried = 2,
        DivorcedWithChild = 3,
        DivorcedWithoutChild = 4,
        Widowed = 5
    }

    //随军情况
    public enum WithArmyStatusEnum
    {
        Unkown = 0,
        NotWithArmyWithChild = 1,
        NotWithArmyWithoutChild =2
    }

    public struct PersonInfo
    {
        public int idperson;        //数据库自动生成，需从数据库中获取，无效值为0
        public string name;
        public PersonTypeEnum type;
        public string sex;
        public string unit;
        public string adminDuty;
        public DateTime adminDutyTime;
        public string techRank;
        public DateTime techRankTime;
        public string techTitle;
        public DateTime techTitleTime;
        public DateTime curRankBeforeTime;
        public DateTime workTime;
        public DateTime schoolTime;
        public DateTime signupTime;
        public DateTime retirementTime;
        public PersonMaritalEnum marital;
        public WorkStatusEnum workStatus;
        public WithArmyStatusEnum withArmy;

        public HousingInfo curHousingAddr;
        public MateInfo mateInfo;
                
        public string remarks;

        public int housingEligible;                         //0, 不具备；1，具备
        public int bothEmployee;                            //0,表示非双职工；1，表示为双职工
        public string evaluation;                           //特殊字段：存放特殊人群的描述字段

        public List<HousingOccupancyInfo> housingInfo;      //已分房id及入住时间信息
        public List<int> formerHousingId;                   //上次住房信息
    }

    struct PersonSortInfo
    {
        public int idperson;

        public string sortGrade;                    //根据 RankMapping 来统一为 “军、正师...”
        public DateTime sortGradeTime;              //根据人员的职别、职务时间，取较早值
        public int sortGradeWeight;                 //级别权重值
        public DateTime sortCurGradeBeforeTime;     //任现副职时间
        public DateTime sortWorkTime;               //这里时间为原始信息的工作时间和上学时间的较早值
        public DateTime sortSignupTime;             //来院时间
        public string sortMateName;                 //配偶姓名，若为null，则代表未婚
        public int sortEvaluationWeight;            //特殊人群权重
        public int sortUnitWeight;                  //单位权重
    }

    //房子原始信息
    struct HousingOriginalInfo
    {
        public int idhousing;
        public string housingType;
        public string housingFullAddr;
        public string streetNo;
        public string buildingNo;
        public string doorWay;
        public string floor;
        public string roomNo;
        public int housingArea;
        public string housingUse;
        public string housingProperty;
        public string remarks;
    }

    public enum ArmmanGradeEnum
    {
        Army = 0,
        Division = 1,
        Regiment = 2,
        Battalion = 3,
        All = 4
    };
}
